package com.thwj.project.app.event;

import com.thwj.project.biz.enums.MessageBelongTypeEnum;
import com.thwj.project.biz.enums.MessageTypeEnum;

public class UserMessageEvent {

    private Long userId;
    private MessageBelongTypeEnum messageBelongTypeEnum;
    private MessageTypeEnum messageTypeEnum;

    private String messageContent;
    private String messageTitle;

    private String unique;

    private Long objectId;
    private String objectPic;
    private String objectContent;
    private Long sendUserId;

    private UserMessageEvent() {
    }

    public static UserMessageBuilder builder() {
        return new UserMessageBuilder();
    }


    public static class UserMessageBuilder {
        private UserMessageEvent msg;

        protected UserMessageBuilder(){
            this.msg = new UserMessageEvent();
        }

        public UserMessageEvent build() {
            return this.msg;
        }

        public UserMessageBuilder setUnique(String unique) {
            this.msg.unique = unique;
            return this;
        }


        public UserMessageBuilder userId(Long userId) {
             this.msg.userId = userId;
             return this;
        }

        public UserMessageBuilder type(MessageTypeEnum typeEnum) {
            this.msg.messageBelongTypeEnum = typeEnum.getBelongTypeEnum();
            this.msg.messageTypeEnum = typeEnum;
            return this;
        }
        public UserMessageBuilder withContent(String content) {
            this.msg.messageContent = content;
            return this;
        }
        public UserMessageBuilder withContent(String title,String content) {
            this.msg.messageTitle = title;
            this.msg.messageContent = content;
            return this;
        }

        public UserMessageBuilder withDynamicParam(Long objectId,String objectPic,String objectContent,Long sendUserId) {
            this.msg.objectId = objectId;
            this.msg.objectPic = objectPic;
            this.msg.objectContent = objectContent;
            this.msg.sendUserId = sendUserId;
            return this;
        }

        public UserMessageBuilder withActivityParam(Long objectId) {
            this.msg.objectId = objectId;
            return this;
        }
    }

    @Override
    public String toString() {
        return "UserMessageEvent{" +
                "userId=" + userId +
                ", messageTypeEnum=" + messageBelongTypeEnum +
                ", messageContent='" + messageContent + '\'' +
                ", messageTitle='" + messageTitle + '\'' +
                ", objectId=" + objectId +
                ", objectPic='" + objectPic + '\'' +
                ", objectContent='" + objectContent + '\'' +
                ", sendUserId='" + sendUserId + '\'' +
                '}';
    }

    public Long getUserId() {
        return userId;
    }

    public MessageTypeEnum getMessageTypeEnum() {
        return messageTypeEnum;
    }

    public String getMessageContent() {
        return messageContent;
    }

    public String getMessageTitle() {
        return messageTitle;
    }

    public Long getObjectId() {
        return objectId;
    }

    public String getObjectPic() {
        return objectPic;
    }

    public String getObjectContent() {
        return objectContent;
    }

    public String getUnique() {
        return unique;
    }

    public Long getSendUserId() {
        return sendUserId;
    }

    public MessageBelongTypeEnum getMessageBelongTypeEnum() {
        return messageBelongTypeEnum;
    }
}
